<?php
/**
 * Created by JetBrains PhpStorm.
 * User: scala
 * Date: 12-10-25
 * Time: 上午9:15
 * To change this template use File | Settings | File Templates.
 */
class UserModel extends Model
{



    protected $_validate=array(
        array('username','/^[a-z]\w{4,25}$/i','帐号格式错误，用户名格式必须是以a-z开头，长度为4-25位!',Model::EXISTS_VALIDATE,"regex",Model::MODEL_INSERT),
        array('nickname','require','昵称必须',Model::EXISTS_VALIDATE),
        array('email','email','邮箱格式不正确！',Model::VALUE_VALIDATE),
        array('username','','帐号名称已经存在！',Model::MUST_VALIDATE,'unique',Model::MODEL_BOTH),
        array('password','require','密码必须！',Model::EXISTS_VALIDATE),
        array('password','2,25','用户名长度为2-25位！',Model::EXISTS_VALIDATE,"length",Model::MODEL_BOTH),
    );


    protected $_auto=array(
        array("createtime","time",Model::MODEL_INSERT,"function"),
        array('update_time','time',Model::MODEL_UPDATE,'function'),
        array("password","md5",Model::MODEL_INSERT,"function"),
        array("createip","get_client_ip",Model::MODEL_INSERT,"function"),
        array("status",1,Model::MODEL_INSERT),
        array("login_count",0,Model::MODEL_INSERT),
    );

}
